package com.mnsq.common.bean.entity.comment;

import com.mnsq.common.bean.entity.CommonEntity;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * @author Administrator
 * @date 2019/3/27 0027
 */
@Data
@Accessors(chain = true)
@Entity
@Table(name = "comment_article", indexes = {@Index(name = "article_id_idx", columnList = "target_id")})
public class CommentSubject extends CommonEntity {
    private static final long serialVersionUID = 124874292982435136L;
    /**
     * 目标对象的主键id
     */
    @Column(name = "target_id", nullable = false)
    private Long targetId;
    /**
     * 目标对象类型
     *
     * @see com.mnsq.common.bean.enums.SubjectType
     */
    @Column(name = "target_type", columnDefinition = "int(2) not null default 1 comment '目标对象类型'")
    private Integer targetType;
    /**
     * 父评论的id（可为空）
     */
    @Column(name = "parent_id", columnDefinition = "bigint(19) not null default 0 comment '父级对象id，默认0'")
    private Long parentId;
    /**
     * 评论内容
     */
    @Column(columnDefinition = "text not null")
    private String content;

    /**
     * 投诉数量
     */
    private Integer hate;
    /**
     * 点赞数量
     */
    private Integer good;
    /**
     * 踩数量
     */
    private Integer bad;
    /**
     * 评论用户主键id
     */
    @Column(name = "user_id", nullable = false)
    private Long userId;
}
